CAT=cat
OUTPUT=output.js
REMOVE_DEBUG=sed -i -e 's/Debug\./\/\/Debug\./g'

generic.js: start.o GownFullConfig.o GenericGownFullBuilder.o GownFullBuilder.o GownFull.o SimpleTableInputMethod.o EditGridInputMethod.o IBInputMethod.o EuropeanLanguageInputMethod.o FramesetInstaller.o
	mv $(OUTPUT) $@
	$(REMOVE_DEBUG) $@

generic_debug.js: start.o Debug.o DebugWindow.o GownFullConfig.o GenericGownFullBuilder.o GownFull.o SimpleTableInputMethod.o EditGridInputMethod.o IBInputMethod.o EuropeanLanguageInputMethod.o FramesetInstaller.o
	echo "Debug.start();" >> $(OUTPUT)
	mv $(OUTPUT) $@

Base.o: Base.js
	$(CAT) $< >> $(OUTPUT)

DataStructure.o: DataStructure.js Base.o
	$(CAT) $< >> $(OUTPUT)

IDGenerator.o: IDGenerator.js Base.o
	$(CAT) $< >> $(OUTPUT)

JSVKBrowserExtension.o: JSVKBrowserExtension.js Base.o GownFullBrowserDetect.o
	$(CAT) $< >> $(OUTPUT)

GownFullObjectAdapter.o: GownFullObjectAdapter.js Base.o lib.o Const.o
	$(CAT) $< >> $(OUTPUT)

GownFullHTMLInputTextAdapter.o: GownFullHTMLInputTextAdapter.js Base.o lib.o GownFullObjectAdapter.o JSVKBrowserExtension.o
	$(CAT) $< >> $(OUTPUT)

GownFullHTMLTextareaAdapter.o: GownFullHTMLTextareaAdapter.js Base.o lib.o GownFullObjectAdapter.o JSVKBrowserExtension.o GownFullHTMLInputTextAdapter.o
	$(CAT) $< >> $(OUTPUT)

GownFullHTMLRichEditAdapter.o: GownFullHTMLRichEditAdapter.js Base.o lib.o GownFullObjectAdapter.o JSVKBrowserExtension.o
	$(CAT) $< >> $(OUTPUT)

GenericExtensionArea.o: GenericExtensionArea.js Base.o lib.o Const.o GownFullConfig.o GFExtensionArea.o JSVKBrowserExtension.o GFWindow.o
	$(CAT) $< >> $(OUTPUT)

GenericGownFullBuilder.o: GenericGownFullBuilder.js Base.o lib.o Const.o GownFullConfig.o GownFullBuilder.o GownFullMenu.o GownFullBrowserDetect.o GownFullHTMLInputTextAdapter.o GownFullHTMLTextareaAdapter.o GownFullHTMLRichEditAdapter.o GenericExtensionArea.o
	$(CAT) $< >> $(OUTPUT)

GFExtensionArea.o: GFExtensionArea.js Base.o lib.o Const.o GownFullConfig.o
	$(CAT) $< >> $(OUTPUT)

GownFullBuilder.o: GownFullBuilder.js Base.o lib.o Const.o GownFullConfig.o GFWindow.o GFExtensionArea.o
	$(CAT) $< >> $(OUTPUT)

GownFullConfig.o: GownFullConfig.js Base.o
	$(CAT) $< >> $(OUTPUT)

GownFullStringTable.o: GownFullStringTable.js Base.o lib.o
	$(CAT) $< >> $(OUTPUT)

DownloadManager.o: DownloadManager.js Base.o lib.o GownFullConfig.o
	$(CAT) $< >> $(OUTPUT)

GFMenu.o: GFMenu.js Base.o lib.o Const.o GownFullConfig.o GownFullBuilder.o
	$(CAT) $< >> $(OUTPUT)

GownFullMenu.o: GownFullMenu.js Base.o lib.o Const.o GownFullConfig.o GFMenu.o GownFullStringTable.o 
	$(CAT) $< >> $(OUTPUT)

GownFull.o: GownFull.js Base.o lib.o Const.o GownFullConfig.o GownFullStringTable.o GownFullBuilder.o GownFullMenu.o DataStructure.o InputMethod.o GownFullFunctionalInterpreter.o GownFullModule.o
	$(CAT) $< >> $(OUTPUT)

InputMethod.o: InputMethod.js Base.o lib.o GownFullConfig.o GownFullStringTable.o GownFullModule.o
	$(CAT) $< >> $(OUTPUT)

GownFullFunctionalInterpreter.o: GownFullFunctionalInterpreter.js Base.o lib.o
	$(CAT) $< >> $(OUTPUT)

GownFullModule.o: GownFullModule.js Base.o lib.o DownloadManager.o GFMenu.o
	$(CAT) $< >> $(OUTPUT)

lib.o: lib.js Base.o Const.o
	$(CAT) $< >> $(OUTPUT)

Const.o: Const.js Base.o
	$(CAT) $< >> $(OUTPUT)

GownFullBrowserDetect.o: GownFullBrowserDetect.js Base.o
	$(CAT) $< >> $(OUTPUT)

GFWindow.o: GFWindow.js Base.o lib.o GownFullBrowserDetect.o
	$(CAT) $< >> $(OUTPUT)

SimpleTableInputMethod.o: SimpleTableInputMethod.js Base.o lib.o InputMethod.o
	$(CAT) $< >> $(OUTPUT)

IBInputMethod.o: IBInputMethod.js Base.o lib.o InputMethod.o
	$(CAT) $< >> $(OUTPUT)

EditGridInputMethod.o: EditGridInputMethod.js Base.o lib.o SimpleTableInputMethod.o
	$(CAT) $< >> $(OUTPUT)

EuropeanLanguageInputMethod.o: EuropeanLanguageInputMethod.js Base.o lib.o DataStructure.o
	$(CAT) $< >> $(OUTPUT)

FramesetGownFullBuilder.o: FramesetGownFullBuilder.js Base.o GenericGownFullBuilder.o
	$(CAT) $< >> $(OUTPUT)

FramesetInstaller.o: FramesetInstaller.js Base.o FramesetGownFullBuilder.o
	$(CAT) $< >> $(OUTPUT)

Debug.o: Debug.js Base.o
	$(CAT) $< >> $(OUTPUT)

DebugWindow.o: DebugWindow.js Base.o GFWindow.o
	$(CAT) $< >> $(OUTPUT)

start.o: start.js
	$(CAT) $< > $(OUTPUT)

clean:
	$(RM) *~ $(OUTPUT) generic.js generic_debug.js mobile.js
